import { create } from 'zustand'

interface CounterType {
  votes: number
  addVotes: () => void
  subtractVotes: () => void
}

const useCounterStore = create<CounterType>((set) => ({
  votes: 0,
  addVotes: () => set((state) => ({ votes: state.votes + 1 })),
  subtractVotes: () => set((state) => ({ votes: state.votes - 1 }))
}))

export default useCounterStore
